import getpass
import telnetlib

HOST = "10.15.1.32"
PORT = "6000"
user = input("Enter your remote account: ")
password = getpass.getpass()

# tn = telnetlib.Telnet(HOST,PORT)
tn = telnetlib.Telnet()
tn.open(HOST,PORT)

rtn = tn.read_until(b"Username:")
print(rtn)
if  rtn.decode().find("Username:") < 0:
	print("not find")
tn.write(user.encode('ascii') + b"\n")
if password:
    tn.read_until(b"Password:")
    tn.write(password.encode('ascii') + b"\n")

tn.write(b"con t\n")
tn.write(b"show lg\n")
tn.write(b"exit\n")
tn.write(b"exit\n")

print(tn.read_all().decode('ascii'))